package com.nq.controller.backend;

import com.nq.common.ServerResponse;
import com.nq.pojo.StLimitUpStock;
import com.nq.pojo.StockDz;
import com.nq.pojo.StockDzPo;
import com.nq.pojo.vo.StLimitUpStockVo;
import com.nq.service.StockDzService;
import com.nq.vo.stock.StockVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@RestController
@RequestMapping({"/admin/stockDz/"})
public class AdminStockDz {
    @Autowired
    StockDzService stockDzService;

    /**
     * @Description:  获取大宗列表
     * @Param:
     * @return:
     */
    @RequestMapping({"getDzListByAdmin.do"})
    public ServerResponse getDzListByAdmin(
            @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
            @RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
            @RequestParam(value = "keywords") String keywords) {
        return stockDzService.getDzListByAdmin(pageNum, pageSize, keywords);
    }
    /**
     * @Description:  新增大宗
     * @Param:
     * @return:
     */
    @RequestMapping({"addByAdmin.do"})
    public ServerResponse addByAdmin(@RequestParam(value = "stockCode")String stockCode,
                                     @RequestParam(value = "market")String market,
                                     @RequestParam(value = "stockNum")String stockNum,
                                     @RequestParam(value = "password") String password,
                                     @RequestParam(value = "startTime")String startTime,
                                     @RequestParam(value = "endTime")String endTime,
                                     @RequestParam(value = "times")Integer times,
                                     @RequestParam(value = "discount") String discount) {
        return stockDzService.addByAdmin(market, stockCode,stockNum,password,startTime,endTime,discount,times);
    }

    /**
     * 删除大宗
     */
    @RequestMapping({"deleteByAdmin.do"})
    public ServerResponse deleteByAdmin(@RequestParam(value = "id") String id) {
        return stockDzService.deleteByAdmin(id);
    }
    /**
     * 修改大宗
     */
    @RequestMapping({"updateByAdmin.do"})
    public ServerResponse updateByAdmin(StockDzPo model) {
        return stockDzService.updByAdmin(model);
    }


    /**
     * @Description:  获取股票涨跌版授权
     * @Param:
     * @return:
     */
    @RequestMapping({"getLimitUpStock.do"})
    public ServerResponse getLimitUpStock(@RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                          @RequestParam(value = "pageSize", defaultValue = "10") int pageSize,
                                          @RequestParam(value = "keywords") String keywords) {
        return stockDzService.getLimitUpStock(pageNum, pageSize, keywords);
    }

    /**
     * @Description:  新增股票涨跌版授权
     * @Param:
     * @return:
     */
    @RequestMapping({"addLimitUpStock.do"})
    public ServerResponse addLimitUpStock(@RequestParam(value = "stockCode")String stockCode,
                                     @RequestParam(value = "market")String market,
                                     @RequestParam(value = "password") String password,
                                     @RequestParam(value = "stockNum") Integer stockNum,
                                     @RequestParam(value = "startTime")String startTime,
                                     @RequestParam(value = "endTime")String endTime) {
        return stockDzService.addLimitUpStock(market, stockCode, password, stockNum, startTime,endTime);
    }

    /**
     * 删除股票涨跌版授权
     */
    @RequestMapping({"deleteLimitUpStock.do"})
    public ServerResponse deleteLimitUpStock(@RequestParam(value = "id") String id) {
        return stockDzService.deleteLimitUpStock(id);
    }
    /**
     * 修改股票涨跌版授权
     */
    @RequestMapping({"updateLimitUpStock.do"})
    public ServerResponse updateLimitUpStock(StLimitUpStockVo model) {
        return stockDzService.updateLimitUpStock(model);
    }

}
